
var MyStack = function () {
    let queue1 = []
    let queue2 = []
};

/** 
 * @param {number} x
 * @return {void}
 */
MyStack.prototype.push = function (x) {
    queue1.push(x)
};

/**
 * @return {number}
 */
MyStack.prototype.pop = function () {
    if (queue1.length) {
        while (queue1.length > 1) {
            queue2.push(queue1.shift())
        }
        let ans = queue1.shift()
        while (queue2.length > 0) {
            queue1.push(queue2.shift())
        }
        return ans
    }
    return null
};

/**
 * @return {number}
 */
MyStack.prototype.top = function () {
    if (queue1.length) {
        return queue1.slice(-1)[0]
    }
    return null
};

/**
 * @return {boolean}
 */
MyStack.prototype.empty = function () {
    if (queue1.slice(-1)[0]) {
        return true
    }
    return false
};